//
//  VTVC1.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2018/8/31.
//  Copyright © 2018年 Lssyyy. All rights reserved.
//

#import "VTVC1.h"

@interface VTVC1 ()
@property (nonatomic,strong) UIView *redView;
@property (nonatomic,strong) UIView *blueView;

@end

@implementation VTVC1
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
   
}


- (void)addUI{
    [self.view addSubview:self.redView];
    self.redView.frame = CGRectMake(50, 50, 200, 200);
    [self.redView addSubview:self.blueView];
    self.blueView.width = 200.0;
    self.blueView.height = 200.0;
    self.blueView.center = CGPointMake(50, 50);
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSLog(@"%@",NSStringFromCGRect(self.redView.bounds));
    NSLog(@"%@",NSStringFromCGRect(self.blueView.bounds));

    [UIView animateWithDuration:1.0 animations:^{
        _blueView.center = CGPointMake(100, 100);
    }];    
}


#pragma mark - VTMagicReuseProtocol
//用于子控制器被重用时，清除旧数据、修正页面偏移等逻辑处理。
- (void)vtm_prepareForReuse {
    // reset content offset
    NSLog(@"clear old data if needed:%@", self);
//    [_titleArray removeAllObjects];
//    [self.collectionView reloadData];
//    [self.collectionView setContentOffset:CGPointZero];
}


- (UIView *)redView{
    if (!_redView) {
        _redView = [UIView new];
        _redView.backgroundColor = [UIColor redColor];
    }
    return _redView;
}

- (UIView *)blueView{
    if (!_blueView) {
        _blueView = [UIView new];
        _blueView.backgroundColor = [UIColor blueColor];
    }
    return _blueView;
}

@end
